package com.qunar.crawler.utils;

import java.util.Calendar;
import java.util.Timer;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CrawlerMain {

	// 抓取的时间间隔
	private static Integer interval = Integer.valueOf(JdbcUtils.getInterval());
	private static final Logger logger = LoggerFactory
			.getLogger(CrawlerMain.class);
	//时间间隔
	 private static final long PERIOD_DAY = 24 * 60 * 60 * 1000;
	
	/**
	 * @author tao.zhang
	 * @param args
	 *            String[]
	 */
	/*public static void main(String[] args) {

		 Calendar calendar = Calendar.getInstance(); 
	       
		  *//*** 每日定时执行方法 ***//* 

		  calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(ConfigUtils.getHour()));
		  calendar.set(Calendar.MINUTE, Integer.parseInt(ConfigUtils.getMin()));
		  calendar.set(Calendar.SECOND, Integer.parseInt(ConfigUtils.getSec()));
		  
		  
		//安排指定的任务在指定的时间开始进行重复的固定延迟执行。
//		  Timer timer = new Timer();
//		  timer.schedule(new Crawler(),calendar.getTime(),PERIOD_DAY);
		
		ScheduledExecutorService pool = Executors.newScheduledThreadPool(1);

		pool.scheduleAtFixedRate(

		new Crawler()

		, 2, PERIOD_DAY, TimeUnit.SECONDS);
//
	}*/
	public static void main(String[] args) {
	    Crawler c= new Crawler();
	    c.run();
	}

}
